import Vue from "vue"
import Vuex from "vuex"
Vue.use(Vuex)
let state = {
	role: ''
}
let mutations = {
	setRole(state, value) {
		state.role = value
	}
}
let actions = {
	async getRole(context, value) {
		await context.commit('setRole', value)
		if (value === 1) {
			uni.redirectTo({
				url: '/pages/tenant/index'
			})
		} else if (value == 2) {
			uni.redirectTo({
				url: '/pages/landlord/index'
			})
		} else if (value == 3) {
			uni.redirectTo({
				url: '/pages/admin/index'
			})
		}
	}
}
export default new Vuex.Store({
	state,
	mutations,
	actions
})